/*
** elf_utils.c for elf_utils in /home/vermel/local/epitech/tek2/c/ftrace/pullup-project/sources
** 
** Made by nathan vermelle
** Login   <vermel_n@epitech.net>
** 
** Started on  Sun Jul  1 17:35:31 2012 nathan vermelle
** Last update Sun Jul  1 17:38:10 2012 nathan vermelle
*/

#include <stdlib.h>
#include "../includes/elf.h"

void	*get_section(t_utils_elf *e, char *name, int *change)
{
  int	cpt;

  cpt = 0;
  while (cpt < e->header->e_shnum)
    {
      if (!strcmp(&e->strtab[e->sectab[cpt].sh_name], name))
	{
	  if (change)
	    *change = e->sectab[cpt].sh_size;
	  return (void *)((unsigned long)e->header
			  + e->sectab[cpt].sh_offset);
	}
      ++cpt;
    }
  return (NULL);
}
